<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script>
//children	取第一层的子节点
//	window.onload=function(){
//		var ul=document.getElementById('ul1')
//		alert(ul.children.length)
//	};

//parentNode	获取元素结构上的父节点

//window.onload=function(){
//	var btn=document.getElementsByTagName('a');
//	for(var i=0;i<btn.length;i++){
//		btn[i].onclick=function(){
//			//alert(this.parentNode)
//			this.parentNode.style.display='none';	
//		};	
//	};	
//};


//offsetParent  获取是物体相对于谁对位
</script>
</head>

<body>
<!--<ul id="ul1">
    <li>111 <a href="javascript:;">隐藏</a></li>
    <li>222 <a href="javascript:;">隐藏</a></li>
    <li>333 <a href="javascript:;">隐藏</a></li>
</ul>
-->
<div id="one" style="width:100px; height:100px; background:red; margin:100px; ">
	<div onclick="alert(this.offsetParent.tagName)" id="two" style="width:100px; height:100px; background:yellow; position:absolute;top:100px;left:100px;">
    
    </div>
</div>
</body>
</html>
